package com.ewzj.bigdata.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewzj.bigdata.R;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;

import java.util.List;

/**
 * Author:zhangjing
 * Time:2018/1/30  上午11:03
 * Name: this is RoundIamgeAdapter
 * Email:zhangjingworkmol@163.com
 */

public class RoundIamgeAdapter extends BaseQuickAdapter<String,BaseViewHolder>{
    private ImageLoader imageLoader;
    public RoundIamgeAdapter(@Nullable List<String> data) {
        super(R.layout.item_imgview, data);
        imageLoader= ArmsUtils.obtainAppComponentFromContext(mContext).imageLoader();
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        imageLoader.loadImage(mContext,ImageConfigImpl.builder()
                .url(item)
//                加载圆角图片
                .transformation(new RoundedCorners(5))
                .imageView(helper.<ImageView>getView(R.id.iv_newimg))
                .build());
    }
}
